package edu.gatech.gitmad.catbug.formation;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class JoinGroupActivity extends Activity {
	private String memberName;
	private String groupID;
	private TextView memberNameView;
	private TextView groupIDView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_join_group);

		memberNameView = (TextView) findViewById(R.id.memberNameJoin);
		groupIDView = (TextView) findViewById(R.id.groupid);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.create_group, menu);
		return true;
	}
	
	public void joinGroup(View view) {
		memberName = memberNameView.getText().toString();
		groupID = groupIDView.getText().toString();
		SessionData.setMemberName(memberName);
		SessionData.setGroupID(groupID);
		Intent intent = new Intent();
		intent.setClass(JoinGroupActivity.this, MapActivity.class);
		startActivity(intent);
	}
}
